\ProvidesPackage{slide}[Slide]

%\usetheme{CambridgeUS}
\usetheme{EastLansing}
%\usetheme{Antibes}
%\usecolortheme{orchid}
\usecolortheme{spruce}
%\usecolortheme{seahorse}
\useinnertheme{rectangles}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{navigation symbols}{} %删除导航栏
%\setbeamertemplate{itemize items}{$\blacksquare$}
%\setbeamertemplate{enumerate items}[square]

\RequirePackage{latexsym,amssymb,amsmath,amsbsy,amsopn,amstext,xcolor}
\RequirePackage{wrapfig,fancybox}
\RequirePackage{multirow,multicol}
\RequirePackage{makecell}
\RequirePackage{diagbox}
\RequirePackage{tikz}

%\RequirePackage[UTF8, scheme=plain, fontset=none]{ctex}
%\RequirePackage{fontspec}%提供字体选择命令
%设置中文字体%
%\setCJKmainfont{NSimSun}%设置正文为黑体
%\setCJKmonofont{NSimHei}%设置等距字体
%\setCJKsansfont{KaiTi}%设置无衬线字体
%\setCJKmainfont[BoldFont={微软雅黑},ItalicFont={KaiTi}]{NSimSun}
%\setCJKsansfont[BoldFont={SimHei},ItalicFont={SimHei}]{NSimSun}
%\setCJKmonofont[BoldFont={SimHei},ItalicFont={SimHei}]{FangSong}
%设置英文字体%
%\setmainfont{Courier New}%英文衬线字体
%\setsansfont{Times New Roman}%英文无衬线字体
%\setmonofont{Arial}%英文等宽字体

\def\mathfamilydefault{\rmdefault}

\RequirePackage{beamerfoils} % logo on or off
\RequirePackage{animate}
\RequirePackage{graphicx}
\RequirePackage{subfigure}
\graphicspath{{figure/}}
\RequirePackage{listings}
\RequirePackage{menukeys}
\RequirePackage{refcount}

\renewcommand{\figurename}{图}
\renewcommand{\tablename}{表}
\renewcommand{\lstlistingname}{例}

\renewcommand{\today}{\number\year 年\number\month 月\number\day 日} % 中文日期
% Write by xuwang
\RequirePackage{pgfplots}
\pgfplotsset{compat=1.18}
\definecolor{bblue}{HTML}{4F81BD}
\definecolor{rred}{HTML}{C0504D}
\definecolor{ggreen}{HTML}{9BBB59}
\definecolor{ppurple}{HTML}{9F4C7C}

\RequirePackage{tikz-timing}
\RequirePackage[american,nooldvoltagedirection]{circuitikz}
\RequirePackage{colortbl}
\RequirePackage{caption}
\DeclareCaptionType{timingdiag}[Timing diagram][List of Timing Diagrams]

\RequirePackage{glossaries}
%\RequirePackage{lscape}
%\RequirePackage{pdflscape}
\usetikzlibrary{backgrounds,calc,shadows,positioning,fit}
\usetikzlibrary{trees,shapes,math,arrows.meta,decorations.pathreplacing,decorations.pathmorphing,calligraphy,patterns}
\usetikzlibrary{circuits.logic.IEC}
\usetikzlibrary{datavisualization,datavisualization.formats.functions,intersections,decorations.markings,plotmarks,tikzmark,angles,quotes,babel,positioning,mindmap}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\RequirePackage{pifont}
\RequirePackage{verbatim} % 多行注释

\renewcommand{\ttdefault}{cmtt}

\makeatletter
\let\old@lstKV@SwitchCases\lstKV@SwitchCases
\def\lstKV@SwitchCases#1#2#3{}
\makeatother
\RequirePackage{lstlinebgrd}
\makeatletter
\let\lstKV@SwitchCases\old@lstKV@SwitchCases

\lst@Key{numbers}{none}{%
    \def\lst@PlaceNumber{\lst@linebgrd}%
    \lstKV@SwitchCases{#1}%
    {none:\\%
     left:\def\lst@PlaceNumber{\llap{\normalfont
                \lst@numberstyle{\thelstnumber}\kern\lst@numbersep}\lst@linebgrd}\\%
     right:\def\lst@PlaceNumber{\rlap{\normalfont
                \kern\linewidth \kern\lst@numbersep
                \lst@numberstyle{\thelstnumber}}\lst@linebgrd}%
    }{\PackageError{Listings}{Numbers #1 unknown}\@ehc}}
\makeatother

\RequirePackage[edges]{forest} %% file structure
\definecolor{folderbg}{RGB}{124,166,198}
\definecolor{folderborder}{RGB}{110,144,169}
\newlength\Size
\setlength\Size{4pt}
\tikzset{%
	folder/.pic={%
			\filldraw [draw=folderborder, top color=folderbg!50, bottom color=folderbg] (-1.05*\Size,0.2\Size+5pt) rectangle ++(.75*\Size,-0.2\Size-5pt);
			\filldraw [draw=folderborder, top color=folderbg!50, bottom color=folderbg] (-1.15*\Size,-\Size) rectangle (1.15*\Size,\Size);
		},
	file/.pic={%
			\filldraw [draw=folderborder, top color=folderbg!5, bottom color=folderbg!10] (-\Size,.4*\Size+5pt) coordinate (a) |- (\Size,-1.2*\Size) coordinate (b) -- ++(0,1.6*\Size) coordinate (c) -- ++(-5pt,5pt) coordinate (d) -- cycle (d) |- (c) ;
		},
}
\forestset{%
declare autowrapped toks={pic me}{},
pic dir tree/.style={%
for tree={%
		folder,
		font=\ttfamily,
		grow'=0,
	},
before typesetting nodes={%
for tree={%
edge label+/.option={pic me},
},
},
},
pic me set/.code n args=2{%
		\forestset{%
			#1/.style={%
					inner xsep=2\Size,
					pic me={pic {#2}},
				}
		}
	},
pic me set={directory}{folder},
pic me set={file}{file},
}

\definecolor{keyword_color}{RGB}{139, 0, 0}
\definecolor{function_color}{RGB}{255,102,0}
\definecolor{comment_color}{RGB}{128,128,128}
\definecolor{string_color}{RGB}{204, 0, 204}
\definecolor{number_color}{RGB}{0, 0, 255}
\definecolor{background_color}{RGB}{251, 251, 251}

\lstdefinelanguage{SystemVerilog}{
	morekeywords={accept_on,alias,always,always_comb,always_ff,always_latch, and,
	assert,assign,assume,automatic,before,begin,bind,bins,binsof,bit,break, buf,
	bufif0,bufif1,byte,case,casex,casez,cell,chandle,checker,class,clocking, cmos,
	config,const,constraint,context,continue,cover,covergroup,coverpoint, cross,
	deassign,default,defparam,design,disable,dist,do,edge,else,end,endcase,
	endchecker,endclass,endclocking,endconfig,endfunction,endgenerate,endgroup,
	endinterface,endmodule,endpackage,endprimitive,endprogram,endproperty,
	endspecify,endsequence,endtable,endtask,enum,event,eventually,expect,export,
	extends,extern,final,first_match,for,force,foreach,forever,fork,forkjoin,
	function,generate,genvar,global,highz0,highz1,if,iff,ifnone,ignore_bins,
	illegal_bins,implements,implies,import,incdir,include,initial,inout,input,
	inside,instance,int,integer,interconnect,interface,intersect,join,join_any,
	join_none,large,let,liblist,library,local,localparam,logic,longint,macromodule,
	matches,medium,modport,module,nand,negedge,nettype,new,nexttime,nmos,nor,
	noshowcancelled,not,notif0,notif1,null,or,output,package,packed,parameter,
	pmos,posedge,primitive,priority,program,property,protected,pull0,pull1,
	pulldown,pullup,pulsestyle_ondetect,pulsestyle_onevent,pure,rand,randc,
	randcase,randsequence,rcmos,real,realtime,ref,reg,reject_on,release,repeat,
	restrict,return,rnmos,rpmos,rtran,rtranif0,rtranif1,s_always,s_eventually,
	s_nexttime,s_until,s_until_with,scalared,sequence,shortint,shortreal,
	showcancelled,signed,small,soft,solve,specify,specparam,static,string,strong,
	strong0,strong1,struct,super,supply0,supply1,sync_accept_on,sync_reject_on,
	table,tagged,task,this,throughout,time,timeprecision,timeunit,tran,tranif0,
	tranif1,tri,tri0,tri1,triand,trior,trireg,type,typedef,union,unique,unique0,
	unsigned,until,until_with,untyped,use,uwire,var,vectored,virtual,void,wait,
	wait_order,wand,weak,weak0,weak1,while,wildcard,wire,with,within,wor,xnor,
	xor,__FILE__,__LINE__,begin_keywords,celldefine,default_nettype,define,else,
	elsif,end_keywords,endcelldefine,endif,ifdef,ifndef,include,line,
	nounconnected_drive,pragma,resetall,timescale,unconnected_drive,undef,undefineall},
	% classoffset=1,
	% morekeywords={$display,$write,$displayb,$writeb,$displayh,$writeh,$displayo,
	% $writeo,$strobe,$monitor,$strobeb,$monitorb,$strobeh,$monitorh,$strobeo,
	% $monitoro,$monitoroff,$monitoron,$fclose,$fopen,$fdisplay,$fwrite,$fdisplayb,
	% $fwriteb,$fdisplayh,$fwriteh,$fdisplayo,$fwriteo,$fstrobe,$fmonitor,$fstrobeb,
	% $fmonitorb,$fstrobeh,$fmonitorh,$fstrobeo,$fmonitoro,$swrite,$sformat,$swriteb,
	% $sformatf,$swriteh,$fgetc,$swriteo,$ungetc,$fscanf,$fgets,$fread,$sscanf,$fseek,
	% $rewind,$fflush,$ftell,$feof,$ferror,$readmemb,$readmemh,$writememb,$writememh,
	% $test$plusargs,$value$plusargs,$dumpfile,$dumpvars,$dumpoff,$dumpon,$dumpall,
	% $dumplimit,$dumpflush,$dumpports,$dumpportsoff,$dumpportson,$dumpportsall,
	% $dumpportslimit,$finish,$stop,$exit,$realtime,$stime,$time,$printtimescale,
	% $timeformat,$bitstoreal,$realtobits,$bitstoshortreal,$shortrealtobits,$itor,
	% $rtoi,$signed,$unsigned,$cast,$bits,$isunbounded,$typename,$unpacked_dimensions,
	% $dimensions,$left,$right,$low,$high,$increment,$size,$clog2,$asin,$ln,$acos,
	% $log10,$atan,$exp,$atan2,$sqrt,$hypot,$pow,$sinh,$floor,$cosh,$ceil,$tanh,$sin,
	% $asinh,$cos,$acosh,$tan,$atanh,$countbits,$countones,$onehot,$onehot0,
	% $isunknown,$fatal,$error,$warning,$info,$fatal,$error,$warning,$info,$asserton,
	% $assertoff,$assertkill,$assertcontrol,$assertpasson,$assertpassoff,
	% $assertfailon,$assertfailoff,$assertnonvacuouson,$assertvacuousoff,$sampled,
	% $rose,$fell,$stable,$changed,$past,$past_gclk,$rose_gclk,$fell_gclk,
	% $stable_gclk,$changed_gclk,$future_gclk,$rising_gclk,$falling_gclk,$steady_gclk,
	% $changing_gclk,$coverage_control,$coverage_get_max,$coverage_get,
	% $coverage_merge,$coverage_save,$get_coverage,$set_coverage_db_name,
	% $load_coverage_db,$random,$dist_chi_square,$dist_erlang,$dist_exponential,
	% $dist_normal,$dist_poisson,$dist_t,$dist_uniform,$q_initialize,$q_add,$q_remove,
	% $q_full,$q_exam,$async$and$array,$async$and$plane,$async$nand$array,
	% $async$nand$plane,$async$or$array,$async$or$plane,$async$nor$array,
	% $async$nor$plane,$sync$and$array,$sync$and$plane,$sync$nand$array,
	% $sync$nand$plane,$sync$or$array,$sync$or$plane,$sync$nor$array,$sync$nor$plane,
	% $system,$urandom,$urandom_range},
	% classoffset=0,
	morecomment=[l]{//},
	morecomment=[s]{/*}{*/},
	morestring=[b]"
}

\lstset{
	mathescape=false,
	escapeinside=,
	sensitive=true,
	emptylines=1,
	backgroundcolor=\color{background_color},
	keywordstyle=\color{keyword_color}\bfseries,
	commentstyle=\color{comment_color},
	stringstyle=\color{string_color},
	basicstyle=\footnotesize\ttfamily, % \small \scriptsize
	breakatwhitespace=false,
	breaklines=true,
	captionpos=t,
	frame=single, % l
	framerule=0.2pt,
	numbers=none, % left
	numberstyle=\footnotesize,
	showspaces=false,
	showstringspaces=false,
	showtabs=false,	
	% frame=lines,
	% rulesep=5pt,
	keepspaces=true,
	% rulesepcolor=\color{gray},
	tabsize=2,
	% title=\lstname,
	upquote=true,
	rulecolor=\color{black},
	columns=flexible, % fixed
	xleftmargin=1em,
	xrightmargin=1em,
	% classoffset=1,
	% keywordstyle=\color{function_color},
	% classoffset=0
}

% restore the tt default family to lmodern tt family
\renewcommand\ttdefault{lmtt}
